package com.panda.command;

import java.util.Map;

class SimpleArgument extends Argument{

    private String command;
    private String key;

    SimpleArgument(String command, String key) {
        this.key = key;
        this.command = command;
    }

    @Override
    boolean canHandle(String a) {
        return a.contains("-" + command);
    }

    @Override
    void doHandle(Map<String, String> as, String a) {

        String o = a.split("-" + command + " *")[1].trim();

        if (!"".equals(o)) {
            as.put(key, o);
        }

    }
}
